<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Hello World</title>
    <script src="../vue.js"></script>
  </head>
  <body>
    <div id="root">
      <child>
        <template slot-scope="props">
          <li>
            <h3>{{ props.hText }}</h3>
            <p>{{ props.item }}</p>
          </li>
        </template>
      </child>
    </div>
    <script>
      Vue.component('child', {
        data() {
          return {
            list: [1, 2, 3, 4]
          }
        },
        template: `<div>
                    <ul>
                      <slot v-for="item of list" :item="item" hText="标题"></slot>
                    </ul>
                  </div>`
      })

      var vm = new Vue({
        el: '#root'
      })
    </script>
  </body>
</html>
